﻿<Window x:Class="WordAssistant.MainWindow"
        xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
        xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
        Title="MainWindow" Height="350" Width="500" Loaded="Window_Loaded">
    <Window.Resources>
        <Style x:Key="CtrlMargin" TargetType="{x:Type Control}">
            <Setter Property="Margin" Value="3" />
        </Style>
        <Style x:Key="TxtStyleAnim" TargetType="{x:Type TextBox}" BasedOn="{StaticResource CtrlMargin}">
            <Setter Property="Background">
                <Setter.Value>
                    <LinearGradientBrush StartPoint="0,0" EndPoint="1,0">
                        <GradientStop Color="#00B7E8BD" Offset="0.0" />
                        <GradientStop Color="#00B7E8BD" Offset="0.0" />
                        <GradientStop Color="#00B7E8BD" Offset="1.0" />
                    </LinearGradientBrush>
                </Setter.Value>
            </Setter>
            <Style.Triggers>
                <EventTrigger RoutedEvent="TextBox.GotFocus">
                    <BeginStoryboard>
                        <Storyboard Timeline.SpeedRatio="4">
                            <ColorAnimation Storyboard.TargetProperty="Background.GradientStops[0].Color" 
                                            From="#00B7E8BD" To="#FFB7E8BD" />
                            <ColorAnimation Storyboard.TargetProperty="Background.GradientStops[1].Color" 
                                            From="#00B7E8BD" To="#BFB7E8BD" />
                            <ColorAnimation Storyboard.TargetProperty="Background.GradientStops[2].Color" 
                                            From="#00B7E8BD" To="#19B7E8BD" />
                            <DoubleAnimation Storyboard.TargetProperty="Background.GradientStops[1].Offset" 
                                            From="0.0" To="0.8" DecelerationRatio="0.3" />
                        </Storyboard>
                    </BeginStoryboard>
                </EventTrigger>
                <EventTrigger RoutedEvent="TextBox.LostFocus">
                    <BeginStoryboard>
                        <Storyboard Timeline.SpeedRatio="4">
                            <ColorAnimation Storyboard.TargetProperty="Background.GradientStops[0].Color" 
                                            From="#FFB7E8BD" To="#00B7E8BD" />
                            <ColorAnimation Storyboard.TargetProperty="Background.GradientStops[1].Color" 
                                            From="#BFB7E8BD" To="#00B7E8BD" />
                            <ColorAnimation Storyboard.TargetProperty="Background.GradientStops[2].Color" 
                                            From="#19B7E8BD" To="#00B7E8BD" />
                            <DoubleAnimation Storyboard.TargetProperty="Background.GradientStops[1].Offset" 
                                            From="0.8" To="0.0" AccelerationRatio="0.3" />
                        </Storyboard>
                    </BeginStoryboard>
                </EventTrigger>
            </Style.Triggers>
        </Style>
    </Window.Resources>
    <Grid Name="gridWholeWnd">
        <Grid.RowDefinitions>
            <RowDefinition Height="Auto" />
            <RowDefinition Height="*" />
            <RowDefinition Height="Auto" />
        </Grid.RowDefinitions>
        <Expander Name="expSetting" Grid.Row="0" Header="Setting" IsExpanded="True">
            <Grid>
                <Grid.RowDefinitions>
                    <RowDefinition Height="*" />
                    <RowDefinition Height="*" />
                </Grid.RowDefinitions>
                <Grid.ColumnDefinitions>
                    <ColumnDefinition Width="80" />
                    <ColumnDefinition Width="*" />
                </Grid.ColumnDefinitions>
                <Label Grid.Row="0" Grid.Column="0" Content="Mp3 File:" Style="{StaticResource CtrlMargin}" />
                <TextBox Name="txtMp3File" Grid.Row="0" Grid.Column="1" Style="{StaticResource TxtStyleAnim}" />
                <Label Grid.Row="1" Grid.Column="0" Content="Lame Exe:" Style="{StaticResource CtrlMargin}" />
                <TextBox Name="txtLameExe" Grid.Row="1" Grid.Column="1" Style="{StaticResource TxtStyleAnim}" />
            </Grid>
            <Expander.Triggers>
                <EventTrigger RoutedEvent="Expander.Expanded">
                    <BeginStoryboard>
                        <Storyboard TargetProperty="Height">
                            <DoubleAnimation To="90" SpeedRatio="3" />
                        </Storyboard>
                    </BeginStoryboard>
                </EventTrigger>
                <EventTrigger RoutedEvent="Expander.Collapsed">
                    <BeginStoryboard>
                        <Storyboard TargetProperty="Height">
                            <DoubleAnimation From="90" To="25" SpeedRatio="3" />
                        </Storyboard>
                    </BeginStoryboard>
                </EventTrigger>
            </Expander.Triggers>
        </Expander>
        <DockPanel Grid.Row="1" VerticalAlignment="Stretch">
            <Label DockPanel.Dock="Top" Content="Words:" HorizontalAlignment="Left" Style="{StaticResource CtrlMargin}" />
            <TextBox Name="txtWords" AcceptsReturn="True" VerticalScrollBarVisibility="Auto" Style="{StaticResource TxtStyleAnim}" />
        </DockPanel>
        <Grid Grid.Row="2">
            <Grid.ColumnDefinitions>
                <ColumnDefinition Width="3*" />
                <ColumnDefinition Width="*" />
            </Grid.ColumnDefinitions>
            <ProgressBar Name="progBar" Visibility="Hidden" />
            <Button Name="btnGenerate" Grid.Column="1" Content="Generate" 
                HorizontalAlignment="Center"  VerticalAlignment="Center" Padding="5" Click="btnGenerate_Click" />
        </Grid>
    </Grid>
</Window>
